package ch.mustaffah.aoide.gui;


import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JPanel;


public class AoideConfigurationPanel extends JPanel implements View {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public AoideConfigurationPanel() {
		initializeView();
	}

	private JButton clearButton;
	private JButton randomPatternButton;
	private JComboBox modeSelectionComboBox;
	private JComboBox timeSelectionComboBox;
	private JComboBox instrumentSelectionComboBox;

	public void initializeView() {
		setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); 
		add(getModeSelection());
		add(getTimeSelection());
//		add(getInstrumentSelection());
//		add(getClearButton());
//		add(getRandomPatternButton());
	}

	public JButton getClearButton() {
		if (this.clearButton == null) {
			this.clearButton = new JButton("clear");
		}
		return this.clearButton;
	}
	
	public JButton getRandomPatternButton() {
		if (this.randomPatternButton == null) {
			this.randomPatternButton = new JButton("random pattern");
		}
		return this.randomPatternButton;
	}

	public JComboBox getModeSelection() {
		if (this.modeSelectionComboBox == null) {
			this.modeSelectionComboBox = new JComboBox(PlayMode.values());
			this.modeSelectionComboBox.setSelectedItem(PlayMode.RANDOM);
		}
		return this.modeSelectionComboBox;
	}
	
	public JComboBox getTimeSelection() {
		if (this.timeSelectionComboBox == null) {
			this.timeSelectionComboBox = new JComboBox(TimeMode.values());
			this.timeSelectionComboBox.setSelectedItem(TimeMode.q);
		}
		return this.timeSelectionComboBox;
	}

	public JComboBox getInstrumentSelection() {
		if (this.instrumentSelectionComboBox == null) {
			this.instrumentSelectionComboBox = new JComboBox(Instruments.values());
		}
		return this.instrumentSelectionComboBox;
	}

}
